<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--[if lt IE 7 ]> <html class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]>    <html class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]>    <html class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]>    <html class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!-->
<html class="no-js">
<!--<![endif]-->
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
        <title>体检预约服务平台 - 医通在线</title>
        <link href="templates/css/global.css" rel="stylesheet" type="text/css" />
        <link href="templates/css/agency.css" rel="stylesheet" type="text/css" />
        <script src="templates/js/form.js" type="text/javascript"></script>
        <script src="templates/js/common.js" type="text/javascript"></script>
        <script src="templates/js/append.js" type="text/javascript"></script>
        <script src="templates/js/jx.js" type="text/javascript"></script>
        <meta content="" name="Keywords">
        <meta name="description" content="" />
        <!--[if IE 6]>
        <script src="templates/js/ddpng.js" type="text/javascript"></script>
        <script type="text/javascript">DD_belatedPNG.fix('.ddpng');</script>
        <![endif]-->

        <script type="text/javascript">
            var userInfo = <{$userInfo1}>;
        </script>
        <script type="text/javascript">
            function sub_form2(){
                var c= '';
                var s='';
                $('input[name^=pd_sa]:checked').each(function(i){
                    c += i;
                    s += "|"+$(this).val();
                });

                if(c==''){
                    alert("请您勾选需要对比的套餐");
                    return false;
                }

                if(c>=14){
                    alert("最多只能选择四个套餐进行对比");
                    return false;
                }
                window.open("/index.php?action=compare&pid2="+s);
            }
        </script>
    </head>
<body>
<!--header st-->
<{include file="../templates/$newtpl/header.html"}>
<FORM style="margin-top:5px" action="/index.php?action=family_3"  method="post" enctype="application/x-www-form-urlencoded" name="appendform" target="_self" id="appendform">

<div class="row mb10 center_layout fix">
    <{include file="../templates/$newtpl/left.html"}>
    <div class="grid0 grid770">
        <div class="main_con">
            <div class="subline"><h4>预约登记</h4><!-- <a href="<{$__URL__}>help" target="_blank" class="yuyue"><s></s>预约须知</a> --></div>
            <div class="step"><img src="templates/images/buy/step_2.png" /></div>
            <div class="con info_box info_make">
                <div class="info_table mb10">
                    <div class="con">
                        <div class="form">
                            <{if $project_add.info_tbts_qtkj!=''}>
                                <h6 class="mb20">特别提示</h6>
                                <p class="tip_box1">
                                    <{$project_add.info_tbts_qtkj}>
                                    <br>
                                    <{$project_add.info_tbts_qtkj_bold}>
                                </p>
                            <{/if}>
                            <h6 class="mb20">预约日期及门店</h6>
                            <dl style="padding:0">
                                <dd class="fix">
                                    <label class="text span1">
                                        1.&nbsp;使用城市：
                                    </label>
                                    <select name="city" class="span1" id="city" >
                                        <option value="">请选择城市</option>
                                        <{foreach from=$city_list key=key item=item name=citys}>
                                            <option value="<{$key}>"><{$item}></option>
                                        <{/foreach}>
                                   </select>
                                    <font color="#FF0000">*</font>
                                </dd>

                                <dd class="fix"><label class="text span1">2.&nbsp;选择门店：</label>
                                    <table class="md_table" id="ses">
                                        <thead>
                                            <tr>
                                                <th width=100>机构</th>
                                                <th width=200>门店</th>
                                                <th width=250>门店地址</th>
                                                <th width=50>选择</th>
                                            </tr>
                                        </thead>
                                        <!-- 家属预约门店列表区域 -->
                                        <tbody id="store" name="store">

                                        </tbody>
                                    </table>
                                </dd>

                                <dd class="fix">
                                        <label class="text span1">3.&nbsp;选择套餐：</label>
                                    <table class="md_table" id="pses">
                                        <thead>
                                            <tr>
                                                <!--<th width=50>对比</th>-->
                                                <th width=250>套餐名</th>
                                               <th width=80>市场价</th>
                                                <th width=80>员工价</th>
                                                <th width=100>您需为家属支付的费用</th>
                                                <th width=100>套餐/门店</th>
                                                <th width=50>选择</th>
                                            </tr>
                                        </thead>
                                        <!-- 家属预约产品列表 -->
                                        <tbody id="product" name="product">
                                        </tbody>
                                    </table>
                                    <{if $sex == 2}>
                                            <div id="dis_show" style="float:left;display:none; margin-left: 119px;">
                                                <span style="color:red">女性已婚套餐比女性未婚套餐多了妇科相关的检查项目。</span>
                                            </div>
                                    <{/if}>

                                </dd>

                                <dd class="fix">
                                    <label class="text span1">套餐加项(可选)：</label>
                                    <table class="md_table">
                                        <thead>
                                            <tr>
                                                <th width=240>加项名称</th>
                                                <th width=120>查看详情</th>
                                                <th width=100>家属价</th>
                                                <!--
                                                    <th>家属价</th>
                                                -->
                                                <th width=50>选择</th>
                                            </tr>
                                        </thead>
                                        <!-- 家属预约加项列表 -->
                                        <tbody id=jx name="jx">
                                        </tbody>
                                    </table>
                                </dd>

                                <dd class="fix">
                                    <label class="text span1">3.&nbsp;预约时间：</label>
                                        <div class="choose">
                                            <input name="yytime" type="text" id="yytime" readonly="" />
                                            <font color="#FF0000">*</font>
                                        </div>

                                        <cite class="red" id="ldtime" name="ldtime"></cite>
                                </dd>
                            </dl>
                            <div id="freeset" name="freeset"></div>
                            <dl style="padding:0">
                                <dd class="fix">
                                    <label class="text span1">体检报告：</label>
                                        <cite><{$report_type_msg|replace:"400-820-6772":"400-820-6772-1-3"}></cite>
                                </dd>
                            </dl>
                            <!--
                                <dl style="padding:0;display:none;" id="ygdiv">
                                    <dd class="fix"><label class="text span1">乙肝报告：</label><cite id="ygbg" style="width: 435px;"></cite></dd>
                                </dl>
                            -->
                            <!--
                                <dl>
                                    <dd class="fix"><label class="text span1">寄送地址：</label><select class="span1"><option>上海</option></select><select class="span1"><option>上海</option></select><select class="span1"><option>上海</option></select></dd>
                                    <dd class="fix"><label class="text span1">&nbsp;</label><input type="text" class="text" style="width:395px;height:20px;line-height:20px" placeholder="请输入详细地址" /></dd>
                                </dl>
                            -->
                        </div>
                    </div>
                </div>
                <div class="btn"><a href="javascript:void(0);"  title="提交预约" class="btn_fin"></a>
                    <input name="name" type="hidden" id="name" value="<{$name}>">
                    <input name="type" type="hidden" id="type" value="<{$type}>">
                    <input name="code" type="hidden" id="code" value="<{$code}>">
                    <input name="birthday" type="hidden" id="birthday" value="<{$birthday}>">
                    <input name="wedding" type="hidden" id="wedding" value="<{$wedding}>">
                    <input name="email" type="hidden" id="email" value="<{$email}>">
                    <input name="invoice" type="hidden"  value="<{$invoice}>">
                    <input name="invoice_header" type="hidden"  value="<{$invoice_header}>">
                    <input name="invoice_content" type="hidden"  value="<{$invoice_content}>">
                    <input name="invoice_type" type="hidden"  value="<{$invoice_type}>">
                    <input name="rec_address" type="hidden"  value="<{$rec_address}>">
                    <input name="projectcode" type="hidden" id="projectcode" value="<{$project_code}>">
                    <input name="wide" type="hidden" id="wide" value="<{$userinfo.user_wide}>">
                    <input name="tel" type="hidden" id="tel" value="<{$tel}>">
                    <input name="sex" type="hidden" id="sex" value="<{$sex}>">
                    <input name="product_code" type="hidden" id="product_code" value="<{$product_code}>">
                </div>
            </div>
        </div>
    </div>
</div>

<{include file="../templates/$newtpl/foot.html"}>
</FORM>
<!--脚本如下-->
<script src="templates/js/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="templates/js/jquery.switchable2.min.js" type="text/javascript"></script>
<script src="templates/js/cal.js" type="text/javascript"></script>
<script src="templates/js/global.js" type="text/javascript"></script>
<script type="text/javascript">
    jQuery(document).ready(function($) {

        /**
         * 获取档期
         */
        $('.choose').click(function(){
            get_free_time_famliy();
        });


        /**
         * 选择城市后触发事件
         */
        $('#city').change(function() {
            //var browser=navigator.appName;
            //var b_version=navigator.appVersion;
            //var version=b_version.split(";");
            //var trim_Version=version[1].replace(/[ ]/g,"");

            var cityid = $('#city').val();
            var project_code = $('#projectcode').val();
            var productcode = '';
            $("#store").empty();
            $("#product").empty();
            $("#jx").empty();
            $("#loading").remove();
            $("#ses").append('<div id="loading" style="text-align:center; "><img src="templates/images/loading_1.gif"></div>');

            $.getJSON("/index.php?action=deliver_store_dj_family&cityid=" + cityid+"&project_code=" + project_code+"&productcode=" + productcode  , function(result) {

                $("#yytime").val('');
                if (result == null) {
                    $("#store").append("<tr><td colspan=4>暂无门店数据</td></tr>");
                } else {
                    $.each(result, function(k, v) {
                        $("#store").append("<tr style='font-size:12px'>" + v[0] + "</td><td><input type='radio' class='radiobtnfix' name='selectstore'  id='selectstore' value='" + v[1] +  "' onclick=storeNotice("+v[1]+");getProductListFamliy();get_store_ldtime(); /></td></tr>");
                    });
                }
                $("#loading").remove();
            });
        });


        /**
         * 点击提交预约按钮
         */
        $('.btn_fin').click(function() {

            var city = $('#city').val();
            var store = $('input[name="selectstore"]:checked').val();
            var projectcode = $('#projectcode').val();
            var yytime = $('#yytime').val();
            var product =  $('input[name="selectproduct"]:checked').val();

            if(city == ''){
                alert('请选择城市');
                return false;
            }else if(typeof(store) == 'undefined'){
                alert('请选择一家门店');
                return false;
            }else if(projectcode == '' ){
                alert('非法的项目编码');
                return false;
            }else if(typeof(product) == 'undefined' ){
                alert('请选择您所需要的套餐');
                return false;
            }else if(yytime == '' ){
                alert('请输入预约时间');
                return false;
            }

            $("#appendform").submit();
        });
    });



    /**
     * 获取员工家属套餐列表
     */
    function getProductListFamliy() {
        var store = $('input[name="selectstore"]:checked').val();
        var project_code = $('#projectcode').val();
        var sex = $('#sex').val();
        var wedding = $('#wedding').val();
        var product_code = $('#product_code').val();
        var jsonstr = product_code.split(",");

        $("#product").empty();
        $("#jx").empty();
        $("#yytime").val('');
        $("#loading").remove();
        $("#pses").append('<div id="loading" style="text-align:center; "><img src="templates/images/loading_1.gif"></div>');

        $.getJSON("/index.php?action=deliver_product_dj_famliy&store="+store+"&project_code=" + project_code+"&sex=" + sex +"&wedding=" + wedding , function(result) {

            if (result == '') {
                $("#product").append("<tr ><td colspan=7>暂无套餐数据</td></tr>");
                $("#no_sa").val('1');
            } else {
                $.each(result, function(k, v) {
                    if(jsonstr.length == 1){
                        if(k == jsonstr[0]){
                            $("#product").append("<tr style='font-size:12px'><td><div align=left>" + v + "</div><td><input type='radio' class='radiobtnfix' onclick=getItemAddonFamily(); name='selectproduct'  id='selectproduct' value='" + k+  "' /></td></tr>");
                        }
                    }else if(jsonstr.length == 2){
                        if(k == jsonstr[0] || k == jsonstr[1]){
                            $("#product").append("<tr style='font-size:12px'><td><div align=left>" + v + "</div><td><input type='radio' class='radiobtnfix' onclick=getItemAddonFamily(); name='selectproduct'  id='selectproduct' value='" + k+  "' /></td></tr>");
                        }
                    }

                    $("#no_sa").val('0');
                });
            }

            $("#loading").remove();
           // $("input[name='selectproduct'][value='"+jsonstr[0]+"'").attr("checked",true);
            getItemAddonFamily();
        });
    }


    /**
     * 获取家属套餐的加项列表
     */
    function getItemAddonFamily() {

        var is_notic = "无加项";
        var selectproduct = $('input[name="selectproduct"]:checked').val();
        var store_id = $('input[name="selectstore"]:checked').val();    

        if(selectproduct ==''){
            alert('请选择套餐');
            return false;
        }

        $.getJSON("/index.php?action=getitem&product="+selectproduct+"&store_id="+store_id+"&time="+new Date().getTime(), function(result) {
            $("#jx").empty();
            if (result == null || result == '') {
                //$("#jx").append("暂无加项数据");
                $("#jx").append("<tr ><td colspan=4>无加项</td></tr>");
            } else {

                var jx_name ='';

                $.each(result, function(k, v) {
                    //console.log('v1='+v[1]+'  ; v2='+v[2]+'  ;v3='+v[3]+'  v4='+v[4]);
                    if(v[4]!=''&&v[4]!=null){
                        jx_name +=' '+v[0];
                        $("#jx").append("<tr style='font-size:12px' ><td><div align=left><a target='_blank' style='margin-left:75px;' href=./index.php?action=product_jx&jxcode="+v[5]+">"+v[0]+"</a></div></td><td><div align=left><a target='_blank' style='margin-left:38px;color:#0e6fa7' href=./index.php?action=product_jx&jxcode="+v[5]+">点击查看</a></div></td><td>￥"+v[2]+"</td><td><span>"+is_notic+"</span><input class='jx_item_select' disabled=disabled style='display:none;' type='checkbox' name='checkbox_value[]' value="+k+" /></td></tr>");
                    } else {
                        $("#jx").append("<tr style='font-size:12px' ><td><div align=left><a target='_blank' style='margin-left:75px;' href=./index.php?action=product_jx&jxcode="+v[5]+">"+v[0]+"</a></div></td><td><div align=left><a target='_blank' style='margin-left:38px;color:#0e6fa7' href=./index.php?action=product_jx&jxcode="+v[5]+">点击查看</a></div></td><td>￥"+v[2]+"</td><td><input class='jx_item_select' type='checkbox' name='checkbox_value[]' value="+k+" /></td></tr>");
                    }
                });

                if(jx_name!=''){
                    //alert("抱歉，该门店不支持 '"+jx_name+"' 加项,请更换其他门店");
                }
            }
        });
    }

    /**
     * 检测门店是否有特殊提示信息
     * 
     * @param  int      storeId     门店id
     */
    function storeNotice(storeId){

        //发送get请求数据
        var getData = {};

        //发送请求地址
        var url = '/index.php?action=get_store_notice';

        var projectCode = "<{$project_code}>";

        var notice = '';

        //检测门店Id是否合法
        if( storeId == '' || typeof(storeId) == 'undefined' ) {
            return false;
        }

        //检测套餐编码是否合法
        // if(productCode == '' || typeof(productCode) == 'undefined' ) {
        //  return false;
        // }

        getData = {
            //门店id
            store_id:storeId,

            //项目编码
            project_code:projectCode,

            //产品编码
            product_code : ''
        }

        //console.log('门店id:' + storeId + ' ; 套餐编码 : '+ productCode + ' ; 项目编码 : ' + projectCode);

        /**
         * 发送get Ajax 请求
         */
        $.getJSON( url , getData , function(data) {
            if( data.status == 1 ) {
                notice = '温馨提示：\n';
                notice +='      '+data.content;
                alert(notice);
            }
        });
    }
</script>
</body>
</html>